home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
bmp_db
/
bmp_db.frm
< prev
next >
Wrap
Text File
|
1995-05-08
|
5KB
|
164 lines
VERSION 2.00
Begin Form BMP_DB
BorderStyle = 3 'Fixed Double
Caption = "Bitmap DataBase Demo"
ClientHeight = 2055
ClientLeft = 2550
ClientTop = 2220
ClientWidth = 3495
Height = 2460
Icon = BMP_DB.FRX:0000
Left = 2490
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 2055
ScaleWidth = 3495
Top = 1875
Width = 3615
Begin PictureBox Picture1
Height = 975
Left = 240
ScaleHeight = 945
ScaleWidth = 1065
TabIndex = 6
Top = 2160
Width = 1095
End
Begin CommandButton Exit
Cancel = -1 'True
Caption = "Exit"
Height = 375
Left = 1920
TabIndex = 4
Top = 1560
Width = 1455
End
Begin CommandButton Load_DB
Caption = "Load DB"
Height = 375
Left = 1920
TabIndex = 5
Top = 120
Width = 1455
End
Begin CommandButton Add_Pic
Caption = "Add..."
Default = -1 'True
Enabled = 0 'False
Height = 375
Left = 1920
TabIndex = 3
Top = 840
Width = 1455
End
Begin VScrollBar VScroll1
Enabled = 0 'False
Height = 1815
Left = 1560
Min = 1
TabIndex = 0
Top = 120
Value = 1
Width = 255
End
Begin CommonDialog CMDialog1
Left = 2400
Top = 1320
End
Begin Shape Shape1
Height = 1335
Left = 120
Top = 120
Width = 1455
End
Begin Label Recnum
BorderStyle = 1 'Fixed Single
Caption = "Record# x of y"
Height = 255
Left = 120
TabIndex = 2
Top = 1680
Width = 1455
End
Begin Label Pic_Caption
BorderStyle = 1 'Fixed Single
Caption = "Caption"
Height = 255
Left = 120
TabIndex = 1
Top = 1440
Width = 1455
End
Begin Image Image1
Height = 1335
Left = 120
Stretch = -1 'True
Top = 120
Width = 1455
End
End
' Declare Form Variables:
Dim Data_file As String ' Declare File Name Variable
Dim Num_of_Entries As Integer ' Number of Records in File.
Sub Add_Pic_Click ()
' Set Dialog Options for Add File
CMDialog1.DialogTitle = "Add File"
CMDialog1.Filter = "All Files (*.*)|*.*|Graphic Files|*.BMP; *.RLE; *.DIB; *.WMF|Bitmaps (*.BMP)|*.BMP|Run-Length Encoding (*.RLE)|*.RLE|DIB (*.DIB)|*.DIB)|Windows Metafile (*.WMF)|*.WMF"
CMDialog1.FilterIndex = 2
CMDialog1.Filename = ""
CMDialog1.Action = 1
' Check for Cancel
If CMDialog1.Filename = "" Then Exit Sub
' Call PiCDB_Add File Routine
P$ = CMDialog1.Filename
PicDB_Add Data_file, P$, InputBox$("Enter Picture Title:", "Picture Title"), Picture1
Num_of_Entries = Num_of_Entries + 1
Recnum.Caption = "Record" + Str$(Vscroll1.Value) + " of" + Str$(Num_of_Entries)
Vscroll1.Enabled = True
Vscroll1.Max = Num_of_Entries
'Update Scroll Bar
VScroll1_Change
End Sub
Sub Exit_Click ()
' Exit Program
End
End Sub
Sub Load_DB_Click ()
' Set Options for Open Dialogbox.
CMDialog1.DialogTitle = "Load DataBase"
CMDialog1.Filename = ""
CMDialog1.Filter = "All Files (*.*)|*.*|Data Files (*.DAT)|*.DAT"
CMDialog1.FilterIndex = 2
' Show Dialog
CMDialog1.Action = 1
' Check for Cancel
If CMDialog1.Filename = "" Then Exit Sub
' Enable File
Data_file = CMDialog1.Filename
Add_Pic.Enabled = True
' Check for Records
Open Data_file For Binary As #1
If LOF(1) = 0 Then Vscroll1.Enabled = False: Close #1: Exit Sub' If no data, disable Scroll Controll, Close File, and exit this sub
Get #1, 1, Num_of_Entries
'After gettin # of entries, display data in Label and Scroll Bar.
Recnum.Caption = "Record 1 of" + Str$(Num_of_Entries)
Vscroll1.Max = Num_of_Entries
Close #1
Vscroll1.Enabled = True
'Update Scroll Box
VScroll1_Change
End Sub
Sub VScroll1_Change ()
'Load Picture and Caption
L% = Vscroll1.Value
PICDB_Load Data_file, L%, P$, Me.Picture1
Image1.Picture = Picture1.Picture
Pic_Caption.Caption = P$
Recnum.Caption = "Record" + Str$(Vscroll1.Value) + " of" + Str$(Vscroll1.Max)
End Sub